import requests
import requests
import json


def get_publickey():
    """获取公钥

    Returns:
        dict: 公钥
    """
    url = "https://gateway.rjmart.cn/auth/rsa/publickey"
    data = {}
    data = json.dumps(data, separators=(',', ':'))
    headers = {
        "Host": "gateway.rjmart.cn",
        "Connection": "keep-alive",
        "sec-ch-ua-platform": "\"macOS\"",
        "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36",
        "Accept": "application/json, text/plain, */*",
        "sec-ch-ua": "\"Google Chrome\";v=\"137\", \"Chromium\";v=\"137\", \"Not/A)Brand\";v=\"24\"",
        "rjk": "x231.259726639.01749456100666.3938.0.8aa1ed3d211f4708851c0a9a6e93f420.0.71",
        "sec-ch-ua-mobile": "?0",
        "Origin": "https://www.rjmart.cn",
        "Sec-Fetch-Site": "same-site",
        "Sec-Fetch-Mode": "cors",
        "Sec-Fetch-Dest": "empty",
        "Referer": "https://www.rjmart.cn/",
        "Accept-Language": "zh-CN,zh;q=0.9",
        "Content-Type": "application/json"
    }
    response = requests.post(url, headers=headers, data=data)
    return response.json()

headers = {
    "Accept": "application/json, text/plain, */*",
    "Accept-Language": "zh-CN,zh;q=0.9",
    "Authorization": "basic d2ViYXBwOndlYmFwcA==",
    "Cache-Control": "no-cache",
    "Connection": "keep-alive",
    "Content-Type": "application/x-www-form-urlencoded",
    "Origin": "https://www.rjmart.cn",
    "Pragma": "no-cache",
    "Referer": "https://www.rjmart.cn/",
    "Sec-Fetch-Dest": "empty",
    "Sec-Fetch-Mode": "cors",
    "Sec-Fetch-Site": "same-site",
    "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36",
    "rjk": "x231.-478080156.11749455673360.-1588424348.26.4f6280c4f7e44c948c1d412d355c4b86.0.80",
    "sec-ch-ua": "\"Google Chrome\";v=\"137\", \"Chromium\";v=\"137\", \"Not/A)Brand\";v=\"24\"",
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": "\"macOS\""
}
url = "https://gateway.rjmart.cn/auth/oauth/token"
params = {
    "net": "4g",
    "scr": "1920x1080",
    "lang": "zh-CN",
    "brid": "4f6280c4f7e44c948c1d412d355c4b86"
}
data = {
    "data": "xFBUF+4Fdxk1dSsUr2VCFaQAM1ovLe1m836OHVc2AMrf65vjYImMYUH1TIY6+6CnJC4VRNuEb088dzfYt713EyIfEQQQyFbILxPNf8NcriNJzgd5fsJK0aeZQV0aPsiELKmuemcWOdfS2hBncFBWD7C26sGpl98v4fsgk2rQLMR2nBIO4kmtBr0khFPtgcnE6Xo+im+QEY+PlNpdNFMlcm+vz9eUzzgaRE+xBWqz4Qwt9D5KgRY8pSAehuvQMjYWsOfD7d8jc40lgK+RgLAKix2DuZo6Y7TXk6GqbBRkUoUn3NyFmhridRESF+pKdRwAfYAd0lod7zYwOQU1MiUjuq0lhA58w3ouVlDEv6pi2+cka08Q6rkr0DbQbBX3F+/31f4GS60oET8d4lVmhBdkoYG/5DTVI0NSFA+OPNyN+c4MCYjDTVygXj/nlW4/idwItroKy3ls9DZRlY8AZwZ2bpgRrgkvTboRFu7ybLU0JWBBIX2PUTFCKbj9BmV/VmeVQSKBdFd+16zY9zEH8AomDLcVYLr+NKakZKV09ekP6NgUnSPMl4rmEan2iXVaU1xNRl/l1mDN7gWRsG91/lKTws0w51/hg1PLaXs0UTAw2XbZs96cpt/qFnJWTglyYm+rqQJMaDVJb6A9Paek6mplIWtlf+E4wMUOpYq29dynrz8="
}
response = requests.post(url, headers=headers, params=params, data=data)

print(response.text)
print(response)